/* 
 * File:   harvestspritetest.cpp
 * Author: dolphinigle
 *
 * Created on March 15, 2011, 6:03 PM
 */

#include <stdlib.h>
#include "gtest/gtest.h"
#include "direction.hpp"
#include "player.hpp"
#include "watersprite.hpp"
#include "game.hpp"
#include "plantablecell.hpp"
#include "plant.hpp"
#include "plantconstants.hpp"

TEST(WaterSpriteTest, All) {

  Game* game = new Game("Irvan", "test.gag");
  
  WaterSprite s(game);

  PlantableCell* pc = (PlantableCell*) game->getMaps()->getField()->getCellAt(2,2);

  EXPECT_FALSE(s.isImportant(pc));

  Plant* p = new Plant(game, pc, 0);
  game->getCreatures()->getPlants()->addPlant(p);

  EXPECT_TRUE(s.isImportant(pc));

  pc->water();

  EXPECT_FALSE(s.isImportant(pc));

  pc->advanceDay();

  EXPECT_TRUE(s.isImportant(pc));

  p->makeHarvestable();
  EXPECT_FALSE(s.isImportant(pc));

  p->makeDead();
  EXPECT_FALSE(s.isImportant(pc));

  p->restartToSeed();
  EXPECT_TRUE(s.isImportant(pc));

  EXPECT_EQ(s.getType(), kWater);

  delete game;

}


